<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<span id="clock"></span>

<script>
    let int = self.setInterval(() => document.getElementById("clock").innerHTML = new Date().toString(), 50);
</script>

<button onclick="window.clearInterval(int)">Stop interval</button>
</body>
</html>